home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
tex
/
meta27
/
mfpandor.lzh
/
pandor.mf
< prev
next >
Wrap
Text File
|
1990-11-16
|
33KB
|
771 lines
%*****************************************************************************
% Copyright (c) 1989 by N. N. Billawala
%*****************************************************************************
% pandor.mf a base file which contains the macros used for creating Pandora
%*****MAJOR CHARACTER PART MACROS**************************************
boolean its_a_leftserif; % in horizontal serif macro
vardef full_serif_points@#(expr A,B,Bl,Br,leftlength,rightlength)=
min_limit(join_radius)(.5serif_thickness);
(z1-B)=whatever*(A@#-B@#); % makes center ref line
(z1l-Bl)=whatever*(A@#-B@#); % makes parallel ref line on left
(z1r-Br)=whatever*(A@#-B@#); % makes parallel ref line on right
y2=y2l=y2r=ypart A; % base of serif
y1=y1l=y1r=y3=y4=ypart A if ypart A>ypart B:-else:+fi serif_thickness;
% puts serif_thickness between A and B
x5=x2=.5[x1l,x1r]; % puts entasis at mid-base and makes it
y5=entasis[y2l,y1l]; % a proportion of the serif_thickness
if its_a_leftserif:x3=x2l=x1l-round(leftlength+serif_constant_amt);
else:x4=x2r=x1r+round(rightlength+serif_constant_amt); fi
enddef;
vardef leftserif@#(expr A,B,Bl,Br,alength)=its_a_leftserif:=true; % left serif
save x,y,p; path p[];
full_serif_points@#(A,B,Bl,Br,alength,0);
p0:=Bl{z1l-Bl} if ctrls:..controls(onstem[z1l,Bl])and(onbase[z1l,z3])..
else:...fi {z3-z1l}z3; % the bracket curve
if midbracket_pull<>0:
z3'l=z1l; pos3'(alength+5pt,.5[angle(B-A),if ypart A>ypart B:-fi 180]);
z8'=p0 intersectionpoint (z3'l--z3'r); % z3'l--z3'r bisects bracket
z8=(midbracket_pull-eps)[z8',z1l];fi % bracket pulled in at z8
if ypart A>ypart B:reverse fi
((if midbracket_pull=0:p0 else:Bl{z1l-Bl}...z8...{z3-z1l}z3 fi
if softpath:)softjoin(z3--z2l)softjoin(else:--fi z2l..z5{right}))
enddef;
vardef rightserif@#(expr A,B,Bl,Br,alength)=its_a_leftserif:=false;% right serif
save x,y,p; path p[];
full_serif_points@#(A,B,Bl,Br,0,alength);
p4:=z4{z1r-z4} if ctrls:..controls(onbase[z1r,z4])and(onstem[z1r,Br])..
else:...fi {Br-z1r}Br; % the bracket curve
if midbracket_pull<>0:
z4'l=z1r; pos4'(alength+5pt,.5[angle(B-A),0]);
z9'=p4 intersectionpoint (z4'l--z4'r); % z4'l--z4'r bisects bracket
z9=(midbracket_pull-eps)[z9',z1r];fi % bracket pulled in at z9
if ypart A>ypart B:reverse fi
((z5{right}..z2r if softpath:)softjoin(z2r--z4)softjoin(else:--fi
if midbracket_pull=0:p4 else:z4{z1r-z4}...z9...{Br-z1r}Br fi))
enddef;
vardef fullserif@#(expr A,B,Bl,Br,leftlength,rightlength)= % full serif
save x,y,p; path p[];
p1=rightserif(A,B,Bl,Br,rightlength); p2=leftserif(A,B,Bl,Br,leftlength);
if ypart A>ypart B:(p1--p2)else:(p2--p1)fi
enddef;
vardef terminalserif@#(expr A,B,Bl,Br,tip_length,base_angle)suffix$=
save x,y,join_radius,aleft,atop,arc,ball,heel,midbracket_point,tip,p;
boolean aleft,atop; pair arc,ball,heel,midbracket_point,tip; path p[];
aleft=(str@#="l"); atop=(ypart A>ypart B);
heel- if aleft:Br else:Bl fi =whatever*(A-B);
heel=A+(whatever,0)rotated(if not aleft:180+ fi base_angle);
ball- if aleft:Bl else:Br fi =whatever*(A-B); ball=whatever[heel,A];
z0=A if atop:-else:+fi(0,terminal_thickness) rotated base_angle;
% z0 added for cases of small terminal_thickness and length
z2=whatever[ball,if aleft:Bl else:Br fi]; (z0-z2)=whatever*(ball-A);
% terminal_thickness and stem intersection when no bracket
z1=z2+(tip_length+serif_constant_amt,0)rotated angle(ball-A);
% z1 is an inner tip point
tip=whatever[heel,ball]; z1-tip=whatever*(z0-A);
% places tip on base by an amount past the stem
z3=heel if str$="soft":+(terminal_softness+1,0)rotated angle(tip-heel)fi;
arc=.5[z3,tip]+(terminal_entasis*terminal_thickness,0)rotated angle(B-A);
if aleft:z5=Bl; z6=Br; else:z5=Br; z6=Bl;fi
p1=z5{ball-z5} if ctrls:
..controls(onstem[z2,z5])and(onbase[z2,(-eps)[z1,tip]])..
else:...fi {z1-z2}(-eps)[z1,tip]--z1;
join_radius:=min(terminal_softness,abs(heel-z3),.5abs(heel-z6));
p2=(arc{heel-tip}...z3{heel-tip}...{heel-tip}heel
if str$="soft":)softjoin(heel fi --z6);
min_limit(join_radius)(.5terminal_thickness);
if midbracket_pull<>0:
bisecting_angle:=if aleft and(sign(angle(B-A))<>sign(angle(ball-A))):
180+fi .5[angle(B-A),angle(ball-A)];
% this angle bisects the inner angle/area of the bracket
z4=z2+(tip_length+5pt+serif_constant_amt,0)rotated bisecting_angle;
% sets point z4 for a reference path along bisecting angle
midbracket_point=(z2--z4)intersectionpoint p1;
% midbracket_point intersects the reference path along the
% bisecting angle and the reference path of the bracket
z9=(midbracket_pull-eps)[midbracket_point,z2];
% the final path goes through z9, which gives the amount of
% "pull" toward the point where the stem meets the terminal
fi % base with no bracketing
if atop=aleft:reverse fi
((if midbracket_pull=0:p1
else:z5{ball-z5}...z9...{z1-z2}(-eps)[z1,z2]--z1 fi
if softpath:)softjoin(z1--tip)softjoin(else:--fi
tip..arc{heel-tip}--p2))
enddef;
vardef arm@# % uses @#strings of tl,tr,bl,br
(expr heel,inner_ref,outer_ref,tip_length,tipthickness,base_angle)suffix$=
save x,y,innertip,outertip,toward,control_point,tip_direction,midbase,section;
pair innertip,outertip,toward,control_point,tip_direction,midbase;
path section[]; % separate parts of path for different join_radii
save_bool(atop)=((str@#="tr")or(str@#="tl"));
save_bool(curvedarm)=(atop and (ypart outer_ref>ypart heel)) or
((not atop) and (ypart outer_ref<ypart heel));
toward=(xpart heel-xpart outer_ref,0); % direction going toward the heel
tip_direction=dir(base_angle if atop:+180 fi-oblique);
z0=whatever[heel,heel+eps*tip_direction]; y0=ypart inner_ref;
outertip=if not curvedarm:z0+(tip_length,0)
else:heel+(max(tip_length,abs(z0-heel)),0) fi rotated angle tip_direction;
midbase=.5[outertip,heel];
innertip=outertip+tipthickness*
dir(base_angle+if((str@#="tl")or(str@#="bl")):- else:+fi 90-oblique);
control_point-innertip=whatever*(heel-outertip);
control_point=whatever[inner_ref,z0];
save_num(join_radius)=
min(.5abs(outertip-heel),abs(heel-outer_ref),arm_softness);
section1=(midbase--heel)softjoin(heel...outer_ref{-toward});
section2=
(inner_ref{toward}
if curvedarm:...
if abs(innertip-control_point)>abs(inner_ref-control_point):
if atop:{downward} else:{upward} fi fi
else:..controls(onstem[control_point,inner_ref])and
(onbase[control_point,innertip])..{outertip-heel} fi
innertip if softpath:)softjoin(innertip--outertip)softjoin( else:--fi
outertip--midbase);
if ((str@#="tl")or(str@#="br")):reverse fi (section2--section1)
enddef;
vardef bulb@# % like arm
(expr heel,inner_ref,outer_ref,tip_length,tipthickness,base_angle)suffix$=
save x,y,athickness,alength,bulb_taper_angle; z0=heel;
if bulbs: save_bool(softpath)=true; fi
if bulb_taper:athickness=1; bulb_thickness:=athickness;
bulb_taper_angle=base_angle
if((str@#="tr")or(str@#="bl")):-else:+fi taper_angle;
alength=if (c_and_s.lc<>0)or(c_and_s.uc<>0):max else:min fi
(abs(ypart outer_ref-ypart inner_ref),tip_length);
else:athickness=tipthickness;alength=tip_length;bulb_taper_angle=base_angle;fi
arm@#(z0,inner_ref,outer_ref,alength,athickness,bulb_taper_angle)$
enddef;
vardef shortarm@#(expr AA,BB,CC,D,E,F)suffix$= % short form inspired by DEK
save x,y,GG,HH,II,JJ,KK,LL,M; pair GG,